const { createProxyMiddleware } = require('http-proxy-middleware');

// 注意：文件名后缀必须是js
module.exports = function (app) {
    app.use(
        '/api/*',
        createProxyMiddleware({
            target: 'http://localhost:8080',
            changeOrigin: true,
            logLevel: "debug", // 日志等级：'debug' | 'info' | 'warn' | 'error' | 'silent'
            pathRewrite: {
                '^/api': '',
            },
        })
    );
    app.use(createProxyMiddleware('/client', {
        target: 'http://localhost:8080',
        pathRewrite: {
          '^/client': '',
        },
        changeOrigin: true,
        secure: false
    }));
};